package website.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import website.domain.User;

@Mapper
public interface UserMapper extends BaseMapper<User> {

    @Update("update tb_user set nickname=#{nickname},signature=#{signature},avatar=#{avatar} where uid=#{uid}")
    int updateUserInfo(User user);

    @Update("update tb_user set salt=#{salt},password=#{password} where uid=#{uid} and email=#{email}")
    int forgetPassword(User one);

    @Select("select * from tb_user where uid=#{uid}")
    User getByUid(Integer uid);

    @Delete("delete from tb_user where uid=#{uid}")
    int deleteByUid(Integer uid);
}
